#define fc "class.dat"
#define fs "student.dat"
FILE *f;

void load()
{
	f=fopen(fc,"rb");
	if (f==NULL)
	{
		printf("\n Program cannot open the file !");
		getch();						
	}	
	else
	{
		ccount=0;
		while (!feof(f))
		{
			fread(&cls[ccount],sizeof(struct_class),1,f);
			ccount++;
		}
		ccount--;
		fclose(f);
	}

	f=fopen(fs,"rb");
	if (f==NULL)
	{
		printf("\n Program cannot open the file !");
		getch();
	}
	else
	{
		scount=0;
		while (!feof(f))
		{
			fread(&stu[scount],sizeof(struct_student),1,f);
			scount++;
		}
		scount--;
		fclose(f);
	}	
}

void save()
{
	int i;
	f=fopen(fc,"wb");
	for(i=0;i<ccount;i++)
	fwrite(&cls[i],sizeof(struct_class),1,f);
	fclose(f);

	f=fopen(fs,"wb");
	for(i=0;i<scount;i++)
	fwrite(&stu[i],sizeof(struct_student),1,f);
	fclose(f);
}
